
import "../choujiang/draw.css"
import React from 'react'
import { inject, observer } from "mobx-react"
import { Button,Space,DatePicker } from 'antd'
import XiaLa from '../../../component/promotion/XiaLaXuanZe'

const { RangePicker } = DatePicker;


@inject('newKaQuan')
@observer
class TianJiaKaQuan extends React.Component {

    componentWillMount(){
        this.props.newKaQuan.selGoods()
    }



    bangDing = (name) => {
        return (e) => this.props.newKaQuan.insertStart(name, e)
    }

    chushihua = () =>{

    }
    
    render() {
        let { myFrom,goodslist } = this.props.newKaQuan

        let xiaLaChange = (name)=>{
            return (e)=>this.props.newKaQuan.insertStart(name,e)
        }

        let methodUpdate = ()=>{
            this.props.newKaQuan.insertData()
        }

        return (
            <div className="draw">
                <h1>添加卡券</h1>
                <div className="content">
                    <div>
                        <div className="itemContentRow">
                            <span>关键字:</span>
                            <input type="text" value={myFrom.cvmKw} onChange={this.bangDing('cvmKw')} placeholder="此劵可抵的金额" />
                        </div>

                        <div className="itemContentRow">
                            <span>对应商品:</span>
                            <XiaLa xiaLaData={goodslist} Change={xiaLaChange}/>
                        </div>

                        <div className="itemContentRow">
                            <span>卡券名称:</span>
                            <input type="text" value={myFrom.cvmRn} onChange={this.bangDing('cvmRn')} placeholder="此劵可抵的金额" />
                        </div>

                        <div className="itemContentRow">
                            <span>卡券前缀:</span>
                            <input type="text" value={myFrom.cvmCvp} onChange={this.bangDing('cvmCvp')} placeholder="此劵可抵的金额" />
                        </div>

                        <div className="itemContentRow">
                            <span>卡券状态:</span>
                            <input type="text" value={myFrom.cradState} onChange={this.bangDing('cradState')} placeholder="此劵可抵的金额" />
                        </div>
                    </div>

                    <div>
                        <div className="itemContentRow">
                            <span>卡号长度:</span>
                            <input type="text" value={myFrom.cvmCnl} onChange={this.bangDing('cvmCnl')} placeholder="此劵可抵的金额" />
                        </div>

                        <div className="itemContentRow">
                            <span>卡号密码:</span>
                            <input type="text" value={myFrom.cvmCnp} onChange={this.bangDing('cvmCnp')} placeholder="此劵可抵的金额" />
                        </div>

                        <div className="itemContentRow">
                            <span>生成数量:</span>
                            <input type="text" value={myFrom.cvmGq} onChange={this.bangDing('cvmGq')} placeholder="此劵可抵的金额" />
                        </div>

                        <div className="itemContentRow">
                            <span>卡券面值:</span>
                            <input type="text" value={myFrom.cvmCfv} onChange={this.bangDing('cvmCfv')} placeholder="此劵可抵的金额" />
                        </div>

                        <div className="itemContentRow">
                            <span>有效日期:</span>
                            <Space direction={myFrom.kaQuanDate} style={{backgroundColor:'black'}} size={12}>
                            <RangePicker onChange={this.bangDing('kaQuanDate')} size={"middle"} />
                        </Space>
                        </div>

                        <div className="itemContentRow">
                            <Button type="primary" onClick={methodUpdate} className="btn">确定</Button>
                        </div>
                    </div>
                </div>





            </div>
        )
    }
}

export default TianJiaKaQuan